<?php

/**
 * Stations filter form base class.
 *
 * @package    TMD
 * @subpackage filter
 * @author     Thaihosting
 */
abstract class BaseStationsFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'IWMO_STATION_NUMBER'      => new sfWidgetFormFilterInput(),
      'SSTATION_NAME_ENG'        => new sfWidgetFormFilterInput(),
      'SSTATION_NAME_THAI'       => new sfWidgetFormFilterInput(),
      'SCHEIF_USER_NAME'         => new sfWidgetFormFilterInput(),
      'SADDRESS_NUMBER'          => new sfWidgetFormFilterInput(),
      'SVILLAGE'                 => new sfWidgetFormFilterInput(),
      'SDISTRICT'                => new sfWidgetFormFilterInput(),
      'SREGION'                  => new sfWidgetFormFilterInput(),
      'SPROVINCE'                => new sfWidgetFormFilterInput(),
      'SPOSTAL_CODE'             => new sfWidgetFormFilterInput(),
      'ILATITUDE_DEGREE'         => new sfWidgetFormFilterInput(),
      'ILATITUDE_MINUTE'         => new sfWidgetFormFilterInput(),
      'ILATITUDE_SECOND'         => new sfWidgetFormFilterInput(),
      'ILONGITUDE_DEGREE'        => new sfWidgetFormFilterInput(),
      'ILONGITUDE_MINUTE'        => new sfWidgetFormFilterInput(),
      'ILONGITUDE_SECOND'        => new sfWidgetFormFilterInput(),
      'DSTATION_HEIGHT'          => new sfWidgetFormFilterInput(),
      'DBAROMETER_HEIGHT'        => new sfWidgetFormFilterInput(),
      'DTHERMOMETER_HEIGHT'      => new sfWidgetFormFilterInput(),
      'DWINDARROW_HEIGHT'        => new sfWidgetFormFilterInput(),
      'DWINDMETER_HEIGHT'        => new sfWidgetFormFilterInput(),
      'DRAINGAUGE_HEIGHT'        => new sfWidgetFormFilterInput(),
      'BTHOURLY_SYNOP'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BT3HOUR_SYNOP'            => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTDAILY_SYNOP'            => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'IGEOGRAPHIC_REGION'       => new sfWidgetFormFilterInput(),
      'DTSAVE_TIME'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'BTSUB_STATION_RAIN'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTHYDRO'                  => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTAGRO'                   => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTACTIVE'                 => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'SPHONE_NUMBER'            => new sfWidgetFormFilterInput(),
      'ITIME_REPORT_PRESSURE'    => new sfWidgetFormFilterInput(),
      'BTREPORT_SEA_STATE'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTREPORT_HOURLY'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTREPORT_3HOUR'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTREPORT_DAILY'           => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTREPORT_WATER_LEVEL'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTREPORT_MICRO_CLIMATE'   => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTREPORT_SUBSTATION_RAIN' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'ISTATION_TYPE'            => new sfWidgetFormFilterInput(),
      'BTREPORT_SEA_VISIBILITY'  => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'DTCREATE_TIME'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'SCONTACT_NAME'            => new sfWidgetFormFilterInput(),
      'ITIME_REPORT_3HOUR'       => new sfWidgetFormFilterInput(),
      'IUSER_ID'                 => new sfWidgetFormFilterInput(),
      'BTREPORT_CLIMAT'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'BTREPORT_UPPERAIR'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'IWMO_STATION_NUMBER'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'SSTATION_NAME_ENG'        => new sfValidatorPass(array('required' => false)),
      'SSTATION_NAME_THAI'       => new sfValidatorPass(array('required' => false)),
      'SCHEIF_USER_NAME'         => new sfValidatorPass(array('required' => false)),
      'SADDRESS_NUMBER'          => new sfValidatorPass(array('required' => false)),
      'SVILLAGE'                 => new sfValidatorPass(array('required' => false)),
      'SDISTRICT'                => new sfValidatorPass(array('required' => false)),
      'SREGION'                  => new sfValidatorPass(array('required' => false)),
      'SPROVINCE'                => new sfValidatorPass(array('required' => false)),
      'SPOSTAL_CODE'             => new sfValidatorPass(array('required' => false)),
      'ILATITUDE_DEGREE'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ILATITUDE_MINUTE'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ILATITUDE_SECOND'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'ILONGITUDE_DEGREE'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ILONGITUDE_MINUTE'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ILONGITUDE_SECOND'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'DSTATION_HEIGHT'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'DBAROMETER_HEIGHT'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'DTHERMOMETER_HEIGHT'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'DWINDARROW_HEIGHT'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'DWINDMETER_HEIGHT'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'DRAINGAUGE_HEIGHT'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'BTHOURLY_SYNOP'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BT3HOUR_SYNOP'            => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTDAILY_SYNOP'            => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'IGEOGRAPHIC_REGION'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'DTSAVE_TIME'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'BTSUB_STATION_RAIN'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTHYDRO'                  => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTAGRO'                   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTACTIVE'                 => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'SPHONE_NUMBER'            => new sfValidatorPass(array('required' => false)),
      'ITIME_REPORT_PRESSURE'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'BTREPORT_SEA_STATE'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTREPORT_HOURLY'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTREPORT_3HOUR'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTREPORT_DAILY'           => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTREPORT_WATER_LEVEL'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTREPORT_MICRO_CLIMATE'   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTREPORT_SUBSTATION_RAIN' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'ISTATION_TYPE'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'BTREPORT_SEA_VISIBILITY'  => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'DTCREATE_TIME'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'SCONTACT_NAME'            => new sfValidatorPass(array('required' => false)),
      'ITIME_REPORT_3HOUR'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'IUSER_ID'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'BTREPORT_CLIMAT'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'BTREPORT_UPPERAIR'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('stations_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Stations';
  }

  public function getFields()
  {
    return array(
      'ISTATION_ID'              => 'Number',
      'IWMO_STATION_NUMBER'      => 'Number',
      'SSTATION_NAME_ENG'        => 'Text',
      'SSTATION_NAME_THAI'       => 'Text',
      'SCHEIF_USER_NAME'         => 'Text',
      'SADDRESS_NUMBER'          => 'Text',
      'SVILLAGE'                 => 'Text',
      'SDISTRICT'                => 'Text',
      'SREGION'                  => 'Text',
      'SPROVINCE'                => 'Text',
      'SPOSTAL_CODE'             => 'Text',
      'ILATITUDE_DEGREE'         => 'Number',
      'ILATITUDE_MINUTE'         => 'Number',
      'ILATITUDE_SECOND'         => 'Number',
      'ILONGITUDE_DEGREE'        => 'Number',
      'ILONGITUDE_MINUTE'        => 'Number',
      'ILONGITUDE_SECOND'        => 'Number',
      'DSTATION_HEIGHT'          => 'Number',
      'DBAROMETER_HEIGHT'        => 'Number',
      'DTHERMOMETER_HEIGHT'      => 'Number',
      'DWINDARROW_HEIGHT'        => 'Number',
      'DWINDMETER_HEIGHT'        => 'Number',
      'DRAINGAUGE_HEIGHT'        => 'Number',
      'BTHOURLY_SYNOP'           => 'Boolean',
      'BT3HOUR_SYNOP'            => 'Boolean',
      'BTDAILY_SYNOP'            => 'Boolean',
      'IGEOGRAPHIC_REGION'       => 'Number',
      'DTSAVE_TIME'              => 'Date',
      'BTSUB_STATION_RAIN'       => 'Boolean',
      'BTHYDRO'                  => 'Boolean',
      'BTAGRO'                   => 'Boolean',
      'BTACTIVE'                 => 'Boolean',
      'SPHONE_NUMBER'            => 'Text',
      'ITIME_REPORT_PRESSURE'    => 'Number',
      'BTREPORT_SEA_STATE'       => 'Boolean',
      'BTREPORT_HOURLY'          => 'Boolean',
      'BTREPORT_3HOUR'           => 'Boolean',
      'BTREPORT_DAILY'           => 'Boolean',
      'BTREPORT_WATER_LEVEL'     => 'Boolean',
      'BTREPORT_MICRO_CLIMATE'   => 'Boolean',
      'BTREPORT_SUBSTATION_RAIN' => 'Boolean',
      'ISTATION_TYPE'            => 'Number',
      'BTREPORT_SEA_VISIBILITY'  => 'Boolean',
      'DTCREATE_TIME'            => 'Date',
      'SCONTACT_NAME'            => 'Text',
      'ITIME_REPORT_3HOUR'       => 'Number',
      'IUSER_ID'                 => 'Number',
      'BTREPORT_CLIMAT'          => 'Boolean',
      'BTREPORT_UPPERAIR'        => 'Boolean',
    );
  }
}
